﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Generate.Common.DTO
{
    /// <summary>
    /// 外键DTO
    /// </summary>
    public class ReferencedColumnDto
    {
        /// <summary>
        /// 主键或者外键
        /// </summary>
        public string Constraint_name { get; set; }

        /// <summary>
        /// 列名
        /// </summary>
        public string ColumnName { get; set; }

        /// <summary>
        /// 外键表明
        /// </summary>
        public string Referenced_table_name { get; set; }

        /// <summary>
        /// 判断字段是否是主键
        /// </summary>
        public bool IsPRIMARY
        {
            get
            {
                return this.Constraint_name == "PRIMARY";
            }
        }

        /// <summary>
        /// 判断是否是外键
        /// </summary>
        public bool IsPK
        {
            get
            {
                return this.Constraint_name.Contains("PK_");
            }
        }
    }
}
